package org.structure.boot.demojpa.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.structure.boot.demojpa.po.User;
import org.structure.boot.demojpa.repository.IUserRepository;
import org.structure.boot.demojpa.service.IUserService;

import javax.annotation.Resource;

/**
 * @version V1.0.0
 * @Title: UserServiceImpl
 * @Package org.structure.boot.demojpa.service.impl
 * @Description: ${TODO} 此类的用途
 * @author: chuck
 * @date: 2020/5/29 17:09
 */
@Slf4j
@Service
public class UserServiceImpl implements IUserService {

    @Resource
    private IUserRepository iUserRepository;

    @Override
    public User findUserById(Integer id) {
        return iUserRepository.findById(id).get();
    }

    @Override
    public User save(User user) {
        User save = iUserRepository.save(user);
        return save;
    }
}
